package com.gzmu.face.mapper;

import com.gzmu.face.entity.Device;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;

/**
 * <p>
 * 设备信息表 Mapper 接口
 * </p>
 *
 * @author xiaobo Yan
 * @since 2020-04-20
 */
@Mapper
public interface DeviceMapper extends BaseMapper<Device> {
    @Insert("INSERT INTO t_device(DeviceID,Name,Version,IPAddr,Submask,Gateway,Listenport,Webport) VALUES(#{DeviceID},#{Name}," +
            "#{Version},#{IPAddr},#{Submask},#{Gateway},#{Listenport},#{Webport}) ON DUPLICATE KEY UPDATE " +
            "Name=#{Name},Version=#{Version},IPAddr=#{IPAddr},Submask=#{Submask},Gateway=#{Gateway},Webport=#{Webport}")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    Integer insertDevice(Device device);
}
